package com.example.xm.adapter.HomeAdapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.example.xm.R;
import com.example.xm.base.BaseAdapter;
import com.example.xm.bean.HomeBean.HomeVideoBean;

import java.util.List;

public class HomeVideoAdapter extends BaseAdapter {



    public HomeVideoAdapter(Context context, List data) {
        super(context, data);
    }

    @Override
    protected int getLayout() {
        return R.layout.fragment_home_video_item;
    }

    @Override
    protected void bindData(BaseViewHolder viewHolder, Object o) {
        ImageView cover = (ImageView) viewHolder.getViewById(R.id.iv_cover);
        TextView title = (TextView) viewHolder.getViewById(R.id.tv_title_video);
        ImageView headimg = (ImageView) viewHolder.getViewById(R.id.iv_head_video);
        TextView name = (TextView) viewHolder.getViewById(R.id.tv_name_video);
        ImageView dianzan = (ImageView) viewHolder.getViewById(R.id.iv_dianzan_video);
        TextView zan_num = (TextView) viewHolder.getViewById(R.id.tv_zan_num_video);
        HomeVideoBean.DataBean.ListBean bean = (HomeVideoBean.DataBean.ListBean) o;
        title.setText(bean.getContent());
        Glide.with(context).load(bean.getCover()).into(cover);
        RequestOptions requestOptions = new RequestOptions().circleCrop();
        Glide.with(context).load(bean.getHeadUrl()).apply(requestOptions).into(headimg);
        name.setText(bean.getNickName());
        zan_num.setText(bean.getLikeNumber()+"");

    }
}
